package com.health.controller;

import com.health.dto.UserLoginDTO;
import com.health.result.Result;
import com.health.service.UserService;
import com.health.vo.UserLoginVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/login")
public class UserLoginController {
    @Autowired
    private UserService userService;
    //登入
    @GetMapping ("/openId")
    public Result login(String code){
        UserLoginVO vo =userService.login(code);
        return Result.success(vo);

    }
    @PostMapping ("/register")
    public Result register(@RequestBody UserLoginDTO userLoginDTO){
        UserLoginVO vo =userService.register(userLoginDTO);
        return Result.success(vo);
    }

}
